<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace controller;

/**
 * Description of Home
 *
 * @author Damian
 */
class Home extends Controller{

    public function index(){
        if($this->shop){
            $this->redirect($this->shop->URL."/shop");
        }
        $crtieria = new \model\Criteria();
        $crtieria->from(\model\TblShop::getModel()->getTable());

        $view = $this->getActionView();
        $shops = \model\TblShop::getModel()->all($crtieria);
        if ($shops){
            $ShopsDataTable = new \model\DataTable($shops,false);
            $view->set("shops",$ShopsDataTable->getModelData(TRUE));
        }        
       // Users::checkLogin($view);
        $this->render();
        //$woj=  new \model\Wojewodztwo();
       // $columns = array_keys($woj->getColumns());
     //  $tab = $woj->order("Nazwa","desc")->fields(["wojewodztwoTeryt"])->where("WojewodztwoID",">","5")->where("WojewodztwoID","<","9")->all();
    // $tab = $woj->all();
    //   var_dump($tab);  
    }
    public function indexNoJS(){
        $this->render();
    }
}
